home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-2.iso / extra_2 / flmgmtcl.zip / XSTRING.H < prev   
C/C++ Source or Header  |  1995-11-02  |  6KB  |  192 lines

  1. // ==========================================================================
  2. //                         Class Specification : CXString
  3. // ==========================================================================
  4.  
  5. // Header file : xstring.h
  6.  
  7. // Source : Periphere NV (R.Mortelmans)
  8. // Creation Date :        2nd November 1995
  9. // Last Modification : 2nd November 1995
  10.                           
  11. // //////////////////////////////////////////////////////////////////////////
  12.  
  13. // Properties:
  14. //    NO    Abstract class (does not have any objects)
  15. //    YES    Derived from CString
  16.  
  17. //    NO    Is a Cwnd.                     
  18. //    NO    Two stage creation (constructor & Create())
  19. //    NO    Has a message map
  20. //    NO  Needs a resource (template)
  21.  
  22. //    YES    Persistent objects (saveable on disk)      
  23. //    NO    Uses exceptions
  24.  
  25. // //////////////////////////////////////////////////////////////////////////
  26.  
  27. // Desciption :         
  28. //        Here some usefulle extensions to the CString class are made available                                              
  29.  
  30. // Remark:
  31. //        A "white space" character is a character in the range 0x09 - 0x0D or 0x20.
  32. //            0x09 : HT : Horizontal Tab    (\t)
  33. //            0x0A : LF : Linefeed        (part of \n)
  34. //            0x0B : VT : Vertical Tab    (\v)
  35. //            0x0C : FF : Formfeed        (\f)
  36. //            0x0D : CR : Carriage return (part of \n)
  37. //            0x20 : space
  38. //        
  39.  
  40. // Prerequisites (necessary conditions):
  41. //        
  42.  
  43. /////////////////////////////////////////////////////////////////////////////
  44.  
  45. #ifndef __XSTRING_H__
  46. #define __XSTRING_H__
  47.  
  48. class CXString : public CString
  49. {
  50. // Data members -------------------------------------------------------------
  51. public:
  52. protected:
  53.     static char cDecimalCharacter;
  54. private:
  55.     
  56. // Member functions ---------------------------------------------------------
  57. public:
  58.     CXString();
  59.     // --- In  :
  60.     // --- Out : 
  61.     // --- Returns :
  62.     // --- Effect : Contructor of object
  63.     //                It will initialize the internal state
  64.  
  65.     CXString::CXString(const char* psz);
  66.     // --- In  : psz
  67.     // --- Out : 
  68.     // --- Returns :
  69.     // --- Effect : Contructor of object out of a pointer to const char
  70.     //                (conversion operator)
  71.     
  72.     CXString(const CString& sSource);
  73.     // --- In  : sSource
  74.     // --- Out : 
  75.     // --- Returns :
  76.     // --- Effect : Contructor of object out of a CString object
  77.     //                (conversion operator)
  78.  
  79.     CXString(LONG nSource);
  80.     // --- In  : nSource
  81.     // --- Out : 
  82.     // --- Returns :
  83.     // --- Effect : Contructor of object out of an int
  84.     //                (conversion operator)
  85.  
  86.     CXString(const CXString& sString);
  87.     // --- In  : xString : the CXString object to be copied
  88.     // --- Out : 
  89.     // --- Returns : 
  90.     // --- Effect : this is the copy constructor
  91.  
  92.     CXString& operator=(const CXString& sString);
  93.     // --- In  : xString : the CXString object to be copied
  94.     // --- Out : 
  95.     // --- Returns : 
  96.     // --- Effect : this is the assignment operator
  97.  
  98.     BOOL CXString::operator==(const CXString& s2) const;
  99.     // --- In  : s2 : The second string
  100.     // --- Out : 
  101.     // --- Returns : Whether the 2 strings (this and s2) are the same
  102.     // --- Effect :  This function compares the 2 contents of the string, 
  103.     //                 regardless whether they contain NULL-characters
  104.     //                 This patches the unexpected behaviour of CString::operator== when a string
  105.     //                 contains NULL-characters
  106.  
  107.     int GetInt() const;
  108.     // --- In  : 
  109.     // --- Out : 
  110.     // --- Returns : The numeric value represented in the string.
  111.     // --- Effect :  The conversion stops at the first character it does not 
  112.     //                 recognize as part of the number
  113.  
  114.     long GetLongInt() const;
  115.     // --- In  : 
  116.     // --- Out : 
  117.     // --- Returns : The numeric value represented in the string.
  118.     // --- Effect :  The conversion stops at the first character it does not 
  119.     //                 recognize as part of the number
  120.  
  121.     void LTrim();
  122.     // --- In  : 
  123.     // --- Out : 
  124.     // --- Returns : 
  125.     // --- Effect : Removes leading white spaces
  126.  
  127.     void RTrim();
  128.     // --- In  : 
  129.     // --- Out : 
  130.     // --- Returns : 
  131.     // --- Effect : Removes trailing white spaces
  132.  
  133.     void XTrim();
  134.     // --- In  : 
  135.     // --- Out : 
  136.     // --- Returns : 
  137.     // --- Effect : Replaces multiple white space characters by one space character
  138.  
  139.     BOOL IsInt();
  140.     // --- In  : 
  141.     // --- Out : 
  142.     // --- Returns : Whether the string contains only digits (TRUE) or not (FALSE)
  143.     //                 Digits are the characters 0 ... 9
  144.     // --- Effect :  
  145.     
  146.     BOOL IsNumber();
  147.     // --- In  : 
  148.     // --- Out : 
  149.     // --- Returns : Whether the string represents a valid number
  150.     // --- Effect :  A valid number has the syntax :
  151.     //         [whitespace] [sign] [digits] [.digits] [ {d | D | e | E}[sign]digits] [whitespace]
  152.     //         A whitespace consists of space and tab characters, which are ignored; 
  153.     //         sign is either plus (+) or minus (-); and digits are one or more 
  154.     //         decimal digits. If no digits appear before the decimal point, 
  155.     //         at least one must appear after the decimal point. 
  156.     //         The decimal digits can be followed by an exponent, which consists of 
  157.     //         an introductory letter (b, D, e, or E) and an optionally signed decimal integer.
  158.     
  159.     void Format(const char* pszFormat, const char** rglpsz, int nString);
  160.     // --- In  :pszFormat : The format specifier containing %1, %2 etc
  161.     //            rglpsz : Pointer to array of strings that must replace %1 etc
  162.     //            nString : The number of strings in the array
  163.     // --- Out : 
  164.     // --- Returns :
  165.     // --- Effect : Substitues all occurences of %1, %2 etc by the corresponding string
  166.     //                in the array
  167.     
  168.     void BarToNull();
  169.     // --- In  :
  170.     // --- Out : 
  171.     // --- Returns :
  172.     // --- Effect : Replaces all the vertical bars ('|') in this string
  173.     //              by NULL-characters
  174.     //                The length of the string stay the same
  175.     //                Because there are NULL-characters embedded within the string
  176.     //              now, be careful when using certain functions
  177.  
  178.     virtual ~CXString();
  179.     // --- In  :
  180.     // --- Out : 
  181.     // --- Returns :
  182.     // --- Effect : Destructor of object
  183.  
  184. protected:
  185.  
  186. private:
  187.  
  188. };
  189.  
  190. #endif
  191. // ==========================================================================
  192.